package com.pmc.api.controller.student.impl;

import com.alibaba.fastjson.JSON;
import com.pmc.api.controller.StudentApi;
import com.pmc.api.controller.student.dto.StudentDTO;
import com.pmc.api.controller.student.dto.StudentQueryDTO;
import com.pmc.app.student.StudentAppService;
import com.pmc.domain.student.vo.StudentQueryVO;
import com.pmc.domain.student.vo.StudentVO;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * StudentApiImpl
 *
 * @author hudeng
 * @version 1.0
 * @description sudent impl
 * @date 2024/7/3 17:49
 */
@Component
public class StudentApiImpl implements StudentApi {
    @Autowired
    private StudentAppService studentAppService;
    @Override
    public List<StudentDTO> queryList(StudentQueryDTO queryDTO) {
        StudentQueryVO queryVO = new StudentQueryVO();
        BeanUtils.copyProperties(queryDTO, queryVO);
        List<StudentVO> studentVOS = studentAppService.queryList(queryVO);
        return JSON.parseArray(JSON.toJSONString(studentVOS), StudentDTO.class);
    }
}
